package com.livery.login;

import com.livery.data.User;
import com.livery.data.Worker;

public class SessionContext {
	
	public static enum PERMISSION{WORKER,SUPERVISOR,ADMIN};
	private static SessionContext session = new SessionContext();
	private PERMISSION permission = PERMISSION.WORKER;
	private String status;
	private Worker worker;
	
	public void setWorker(Worker worker,PERMISSION type){
		
		permission = type;
		this.worker = worker;
		status = "Zalogowano jako " + worker.getFirstName() + " " + worker.getLastName();
	}
	public User getWorker(){
		return worker;
	}
	
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public PERMISSION getPermission() {
		return permission;
	}
	public void setPermission(PERMISSION permission) {
		this.permission = permission;
	}
	private SessionContext(){
		status = "Nie zalogowano";
	}
	public static SessionContext getInstance(){
		return session;
	}
}
